﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using System.Activities.Presentation.Model;

namespace TransactionServer.ActivityDesign.Components
{
    class BooleanControl : ComboBox
    {

        public static readonly DependencyProperty ModelProperty =
        DependencyProperty.Register("Model", typeof(ModelItem), typeof(BooleanControl),
        new FrameworkPropertyMetadata(
            null,
            FrameworkPropertyMetadataOptions.AffectsMeasure,
            new PropertyChangedCallback(GetMappingNames),
            null
        ));

        public ModelItem Model
        {
            get
            {
                return (ModelItem)GetValue(ModelProperty);
            }
            set
            {
                SetValue(ModelProperty, value);
            }
        }

        public static void GetMappingNames(DependencyObject dObject, DependencyPropertyChangedEventArgs eventArgs)
        {
            var entityControl = (BooleanControl)dObject;
            List<string> source = new List<string>();
            source.Add("Да");
            source.Add("Нет");
            entityControl.ItemsSource = source;
        }
    }
}
